<?php
/**
 * Class for definition author config file
 *
 * @author Vadim Kruchkov <long@phargo.net>
 * @version SVN: $Id: EPhaAuthor.php 7 2011-03-05 14:31:52Z long@phargo.net $
 */
class EPhaAuthor {

    const AUTHOR_DIR_NAME = 'author';

    /**
     * Return name of author or false
     *
     * @return string
     */
    static public function get( $sPath = null ) {
        $mReturn = false;

        // Path to directory for author defenition
        if (is_null( $sPath ))
            $sPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . self::AUTHOR_DIR_NAME . DIRECTORY_SEPARATOR;

        $oDir = dir( $sPath );
        while (false !== ($sEntry = $oDir->read())) {
            if($sEntry != '.' && $sEntry != '..' && !is_dir($sPath.$sEntry)) {
                if ($sEntry[0] === '.') {
                    $mReturn = substr($sEntry, 1, strlen($sEntry));
                }
            }
        }
        unset($oDir);

        return $mReturn;
    }
}